import React, { useEffect, useState } from 'react';
import { getList } from "../../apis/api";
import { Avatar, List,Space  } from 'antd';
import { LikeOutlined, MessageOutlined, StarOutlined } from '@ant-design/icons';
function Detail() {
    const [data,setData]=useState('')
    const datas=[
        {
            
            imgs:'https://ts1.tc.mm.bing.net/th?id=ORMS.f32b72c2c011757354ac6a7fe2c1a9e4&pid=Wdp&w=612&h=304&qlt=90&c=1&rs=1&dpr=1.25&p=0',
            
        },
        {
            
            imgs:'https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/388379538bf2af745f3f7cfea82816a2.jpg?x-oss-process=image%2fresize%2cm_lfit%2cw_3840%2ch_2160',
            
        },
        {
            
            imgs:'https://img.shetu66.com/2023/06/29/1688025012523974.png',
            
        },
        {
            
            imgs:'https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/a4788a98db537b3ea2afa945cbd2333e.jpg?x-oss-process=image%2fresize%2cm_lfit%2cw_3840%2ch_2160',
            
        },
        {
            
            imgs:'https://ts3.tc.mm.bing.net/th/id/OIP-C.CPT9rqYgV440rm-jc88zGgAAAA?rs=1&pid=ImgDetMain&o=7&rm=3',
            
        },
    ]
    const aa=async()=>{
        const res=await getList({
            page:1,//页码  必传
pageSize:6,//每页显示条数 必传
keyword:null,//搜索标题
tag:null//搜索标签

        })
        console.log(res.data.rows);
        setData(res.data.rows)
        
    }
    useEffect(()=>{
        aa()
    },[])
    const IconText = ({ icon, text })=> (
  <Space>
    {React.createElement(icon)}
    {text}
  </Space>
);
    return (
        <div>
            
            {data&&data.map((item,index)=>{
                return  <List
    itemLayout="vertical"
    size="large"
    
    dataSource={data}
    footer={
      <div>
        <b>ant design</b> footer part
      </div>
    }
    renderItem={(item) => (
      <List.Item
        key={item.id}
        actions={[
          <IconText icon={StarOutlined} text="156" key="list-vertical-star-o" />,
          <IconText icon={LikeOutlined} text="156" key="list-vertical-like-o" />,
          <IconText icon={MessageOutlined} text="2" key="list-vertical-message" />,
        ]}
        extra={
          <img
            width={272}
            alt="logo"
            src='https://img.shetu66.com/2023/06/29/1688025012523974.png'
          />
          
        }
      >
        <List.Item.Meta
          title={item.title}
        />
        {item.content}
      </List.Item>
    )}
  />
            })}
        </div>
    );
}

export default Detail;